/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Domain.Inductance;
import EA_Model.IEC61970.Domain.Resistance;

import EA_Model.IEC61970.Wires.DCLineSegment;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>DC Line Segment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.DCLineSegmentImpl#getDcSegmentInductance <em>Dc Segment Inductance</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.DCLineSegmentImpl#getDcSegmentResistance <em>Dc Segment Resistance</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DCLineSegmentImpl extends ConductorImpl implements DCLineSegment {
	/**
	 * The cached value of the '{@link #getDcSegmentInductance() <em>Dc Segment Inductance</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDcSegmentInductance()
	 * @generated
	 * @ordered
	 */
	protected Inductance dcSegmentInductance;

	/**
	 * The cached value of the '{@link #getDcSegmentResistance() <em>Dc Segment Resistance</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDcSegmentResistance()
	 * @generated
	 * @ordered
	 */
	protected Resistance dcSegmentResistance;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DCLineSegmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.DC_LINE_SEGMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Inductance getDcSegmentInductance() {
		if (dcSegmentInductance != null && dcSegmentInductance.eIsProxy()) {
			InternalEObject oldDcSegmentInductance = (InternalEObject)dcSegmentInductance;
			dcSegmentInductance = (Inductance)eResolveProxy(oldDcSegmentInductance);
			if (dcSegmentInductance != oldDcSegmentInductance) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE, oldDcSegmentInductance, dcSegmentInductance));
			}
		}
		return dcSegmentInductance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Inductance basicGetDcSegmentInductance() {
		return dcSegmentInductance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDcSegmentInductance(Inductance newDcSegmentInductance) {
		Inductance oldDcSegmentInductance = dcSegmentInductance;
		dcSegmentInductance = newDcSegmentInductance;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE, oldDcSegmentInductance, dcSegmentInductance));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Resistance getDcSegmentResistance() {
		if (dcSegmentResistance != null && dcSegmentResistance.eIsProxy()) {
			InternalEObject oldDcSegmentResistance = (InternalEObject)dcSegmentResistance;
			dcSegmentResistance = (Resistance)eResolveProxy(oldDcSegmentResistance);
			if (dcSegmentResistance != oldDcSegmentResistance) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE, oldDcSegmentResistance, dcSegmentResistance));
			}
		}
		return dcSegmentResistance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Resistance basicGetDcSegmentResistance() {
		return dcSegmentResistance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDcSegmentResistance(Resistance newDcSegmentResistance) {
		Resistance oldDcSegmentResistance = dcSegmentResistance;
		dcSegmentResistance = newDcSegmentResistance;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE, oldDcSegmentResistance, dcSegmentResistance));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE:
				if (resolve) return getDcSegmentInductance();
				return basicGetDcSegmentInductance();
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE:
				if (resolve) return getDcSegmentResistance();
				return basicGetDcSegmentResistance();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE:
				setDcSegmentInductance((Inductance)newValue);
				return;
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE:
				setDcSegmentResistance((Resistance)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE:
				setDcSegmentInductance((Inductance)null);
				return;
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE:
				setDcSegmentResistance((Resistance)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_INDUCTANCE:
				return dcSegmentInductance != null;
			case WiresPackage.DC_LINE_SEGMENT__DC_SEGMENT_RESISTANCE:
				return dcSegmentResistance != null;
		}
		return super.eIsSet(featureID);
	}

} //DCLineSegmentImpl
